﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ORM.EF.Controls
{
    /// <summary>
    /// UCInfoBase.xaml 的交互逻辑
    /// </summary>
    public partial class UCInfoBase : UserControl
    {
        public UCInfoBase()
        {
            InitializeComponent();
        }

        private void btn_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            switch (btn.Name)
            {
                case "btn_new":
                    OnBtnClick?.Invoke("new", null);
                    break;
                case "btn_mod":
                    OnBtnClick?.Invoke("mod", null);
                    break;
                case "btn_del":
                    OnBtnClick?.Invoke("del", null);
                    break;
                case "btn_ref":
                    OnBtnClick?.Invoke("ref", null);
                    break;
                default:
                    break;
            }
            MessageBox.Show(btn.Name);
        }

        public event EventHandler OnBtnClick;
    }
}
